﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/*
 * TH07 Groep 10
 * ----------------------------------------------------------------------------------
 * Versie   Door        Commentaar
 * 0.1      Mike        Opzet en programmeer werk
 * 0.2      Luca        Optimalisatie code
 *                      Hernoemen variabelen en functies
 *                      overbodige code verwijderd 
 *                      crop image naar eigen tool classe verplaatst.
 * 0.3      Luca        wekrte niet meer, tijdens constructor werd waarde aanzich zelf ge-assigned
 *                      ipv this.variable = variable (was variable = variable)
 *               
 */

namespace THO7AlgoritmTimerApplication
{
    class TrainedCharacter
    {
        #region private variables
        private char character;
        private byte[] properties;
        #endregion

        #region public setters & getters
        public byte[] Properties
        {
            get { return properties; }
            set { properties = value; }
        }

        public byte GetProperty(int position)
        {
            return properties[position];
        }

        public char Character
        {
            get { return character; }
        }
        #endregion

        #region constructors
        public TrainedCharacter(char character, byte[] properties)
        {
            this.character = character;
            this.properties = properties;
        }
        #endregion

        /// <summary>
        /// Try to match a character
        /// </summary>
        /// <param name="character"></param>
        /// <returns></returns>
        public int Match(Character character)
        {
            byte[] charProperties = character.Properties;
            int difference = 0;
            for (int i = 0; i < 25; i++)
            {
                if (charProperties[i] > properties[i])
                {
                    difference += (charProperties[i] - properties[i]);
                }
                else
                {
                    difference += (properties[i] - charProperties[i]);
                }
            }
            return difference;
        }

    }
}
